<?php
ob_start();
require_once("index.class.php");
require_once("setcookie.php");
$yanzhengma = $page->yanzhengma;
$jumpUrl = $page->jumpUrl;
$errorMes = $page->errorMes;
$userNumber = $page->userNumber;
if (!$userNumber){
	$userNumber= $_COOKIE["userNumber"];
}
ob_end_flush();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="飘零管理系统，飘零博客，飘零管理" />
<meta name="keywords" content="飘零,飘零管理，magento，PHP，mysql，jquery，javascript" />
<meta name="author" content="piaoling" />
<meta name="google-site-verification" content="fP1BG5o06JBGBus8w-fBCIE9MvhUogapE0Tl-hCZPg0" />
<meta name="robots" content="all" />
<title>个人助理</title>
<style type="text/css">@import "style/main.css";</style>
<script language="javascript" type="text/javascript" src="<?php echo $baseDirec?>js/jquery-1.5.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $baseDirec?>js/hhl.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $baseDirec?>js/base.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $baseDirec?>js/drage.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $baseDirec?>js/ajax.js"></script>
<link href="" type="text/css" rel="stylesheet" />
</head>
<body id="mainindex">
  <div id="index">
	<form action="index.php" method="POST" class="loginform" name="login" onsubmit ="return loginSubmitCheck()">
		<div id="loginErrorMes"><?php echo $errorMes;?></div>
		<input type="hidden" name = "jumpUrl" value="<?php echo $jumpUrl;?>" />
		用户名：<input type="text" name="userNumber" id="userNumber" class="loginuserzhanghao" value="<?php echo $userNumber;?>" onfocus="setMouseOnfouseStyle(this)" onblur="setMouseOnblurStyle(this)" /><br />
		密&nbsp;&nbsp;&nbsp;码：<input type="password" name="userPwd" id="userPwd" class="loginuserzhanghao2" onfocus="setMouseOnfouseStyle(this)" onblur="setMouseOnblurStyle(this)" /><br />
		验证码：<input type="text" name="yanZhengMa" id="yanZhengMa" class="loginuserzhanghao"  onfocus="setMouseOnfouseStyle(this)" onblur="setMouseOnblurStyle(this)" /><input type="text" name="oYanZhengMa" value="<?php echo $yanzhengma;?>" class="loginyanzhengma" readonly /><br /><br />
		<input type="checkbox" name="remember" id="remember" value="1" />记住登陆状态<br /><br />
		<input type="submit" class="loginSubmit" value="登陆" /><input type="button" class="loginSubmit" id="register" value="注册" />
	</form>
 </div>
	<?php
	//设置光标聚集点
	if ($userNumber==""){
		echo "<script>document.getElementsByName('userNumber')[0].focus();</script>";
	}
	else {
		echo "<script>document.getElementsByName('userPwd')[0].focus();</script>";
	}
	?>
	<script>
		$("#register").click(register);
		function register(){
			var url = "register.php";
			//var data = {"userNumber","userName","userPwd","userPwdConfir"};
			$.ajax({
				type:"POST",
				data:"",
				url:url,
				success:function(data){
					$("body").append("<div id='wholemark'></div>");
					var p = HHL.getPosition();
					var width = p.Tw;
					var height = p.Th;
					$("#wholemark").css({"width":width,"height":height});
					$("body").append("<div id='registerTemplate'>"+data+"</div>");
					left=width/3-60;top=100;
					$("#registerTemplate").css({"left":left,"top":top,"z-index":"5"});
				}
			});
		}
		$("#registerRButton").click(doRegister);
		function doRegister(){		
			var userNumber = $("#userAcountR").val();
			var userNickName = $("#userNickName").val();
			var userPasswordR = $("#userPasswordR").val();
			var userPasswordconfirmR = $("#userPasswordconfirmR").val();
			if(userPasswordR!==userPasswordconfirmR){
				HHL.newAlertMes("<img src='style/error-msg.png' />两次输入密码不一致！","","2000");
				$("#userPasswordR").focus();
				return false;
			}
			if(!HHL.trim(userNumber)){
				HHL.newAlertMes("<img src='style/error-msg.png' />用户账号不能为空！","","2000");
				$("#userAcountR").focus();
				return false;
			}
			if(!HHL.trim(userPasswordR)){
				HHL.newAlertMes("<img src='style/error-msg.png' />用户密码不能为空！","","2000");
				$("#userPasswordR").focus();
				return false;
			}
			var url = "register.php";
			var data ={"userNumber":userNumber,"userPasswordR":userPasswordR,"userNickName":userNickName};
			$.ajax({
				type:"POST",
				data:data,
				url:url,
				success:function(data){
					if(data=="0"){
						HHL.newAlertMes("<img src='style/error-msg.png' />注册失败，请稍后重试！","","2000");
					}else if(data=="exsit"){
						HHL.newAlertMes("<img src='style/error-msg.png' />账号已存在！","","2000");
						$("#userAcountR").css({"border-color":"red"});
					}else if(data=="ok"){
						HHL.newAlertMes("<img src =style/success-msg.png />注册成功！","","2000");
						setTimeout("window.location.href='friendlist.php'",2500);
					}
				}
			});
		}
		function closeRegisterT(){
			$("#wholemark").remove();
			$("#registerTemplate").remove();	
		}
		$(document).ready(function(){
			$(".loginform").css({"margin-top":"100px"})
		})
	</script>



</body>
</html>

 
